﻿// EXP0316.cpp : 编写一段程序，把练习3.13中vector对象的容量和具体内容输出出来
//

#include <iostream>
#include <vector>
using namespace std;

int main()
{
	vector<int> v1;         //size=0
	vector<int> v2(10);     //size=10,v2[0]~[9]=0
	vector<int> v3(10, 42); //size=10,v3[0]~[9]=42
	vector<int> v4{ 10 };     //size=1,v4[0]=10
	vector<int> v5{ 10, 42 }; //size=2,v5[0]=10,value[1]=42
	vector<string> v6{ 10 };  //size=10,v6[0]~[9]=""
	vector<string> v7{ 10, "hi" };  //size=10,v7[0]~[9]="hi"

	copy(v1.begin(), v1.end(), ostream_iterator<int>(cout, " "));
	cout <<"\nv1.size="<<v1.size() <<endl;
	cout << "-------------------------------" << endl;
	copy(v2.begin(), v2.end(), ostream_iterator<int>(cout, " "));
	cout << "\nv2.size=" << v2.size() << endl;
	cout << "-------------------------------" << endl;
	copy(v3.begin(), v3.end(), ostream_iterator<int>(cout, " "));
	cout << "\nv3.size=" << v3.size() << endl;
	cout << "-------------------------------" << endl;
	copy(v4.begin(), v4.end(), ostream_iterator<int>(cout, " "));
	cout << "\nv4.size=" << v4.size() << endl;
	cout << "-------------------------------" << endl;
	copy(v5.begin(), v5.end(), ostream_iterator<int>(cout, " "));
	cout << "\nv5.size=" << v5.size() << endl;
	cout << "-------------------------------" << endl;
	copy(v6.begin(), v6.end(), ostream_iterator<string >(cout, " "));
	cout << "\nv6.size=" << v6.size() << endl;
	cout << "-------------------------------" << endl;
	copy(v7.begin(), v7.end(), ostream_iterator<string >(cout, " "));
	cout << "\nv7.size=" << v7.size() << endl;


	return 0;
}


